home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / C and C++ / Libraries / Effect library / Demo ƒ / Wipes ƒ / Skipaline L-R.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-09  |  2.3 KB  |  68 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        Skipaline L-R.c
  4.  
  5. Purpose:    Graphic effect from offscreen bitmap to main window (on
  6.             screen).  See comments below for more description.
  7.  
  8.  
  9. MSG Demo -- graphic effects demonstration program
  10. Copyright (C) 1992-4 Mark Pilgrim & Dave Blumenthal
  11.  
  12. This program is free software; you can redistribute it and/or modify
  13. it under the terms of the GNU General Public License as published by
  14. the Free Software Foundation; either version 2 of the License, or
  15. (at your option) any later version.
  16.  
  17. This program is distributed in the hope that it will be useful,
  18. but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  20. GNU General Public License for more details.
  21.  
  22. You should have received a copy of the GNU General Public License
  23. along with this program in a file named "GNU General Public License".
  24. If not, write to the Free Software Foundation, 675 Mass Ave,
  25. Cambridge, MA 02139, USA.
  26.  
  27. \**********************************************************************/
  28.  
  29. #include "msg timing.h"
  30.  
  31. #define CorrectTime 1
  32. #define theWindowWidth (boundsRect.right-boundsRect.left)
  33. #define theWindowHeight (boundsRect.bottom-boundsRect.top)
  34.  
  35. pascal short SkipalineLR(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect);
  36.  
  37. /* Copy even-numbered columns starting at the left and moving right, and odd-
  38.    numbered columns starting at the right and moving left.  */
  39.    
  40. pascal short SkipalineLR(GrafPtr sourceGrafPtr, GrafPtr destGrafPtr, Rect boundsRect)
  41. {
  42.     Rect        thisone,thatone;
  43.     Boolean        everyOther=FALSE;
  44.     
  45.     SetRect(&thisone, boundsRect.left, boundsRect.top, boundsRect.left+1, boundsRect.bottom);
  46.     SetRect(&thatone, boundsRect.right-1, boundsRect.top, boundsRect.right, boundsRect.bottom);
  47.     if (theWindowWidth%2)
  48.         OffsetRect(&thatone, -1, 0);
  49.     
  50.     while (thisone.left<boundsRect.right)
  51.     {
  52.         StartTiming();
  53.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  54.             &thisone, &thisone, 0, 0L);
  55.         CopyBits(&(sourceGrafPtr->portBits), &(destGrafPtr->portBits),
  56.             &thatone, &thatone, 0, 0L);
  57.         thisone.left+=2;      /* left column moves right by 2 */
  58.         thisone.right+=2;
  59.         thatone.left-=2;      /* right column moves left by 2 */
  60.         thatone.right-=2;
  61.         if (everyOther)
  62.             TimeCorrection(CorrectTime);
  63.         everyOther=!everyOther;
  64.     }
  65.     
  66.     return 0;
  67. }
  68.